﻿using System.Configuration;

namespace CID.Tests.Support.Configuration.Database
{
    public class InitializationVariableCollection : ConfigurationElementCollection
    {
        public override ConfigurationElementCollectionType CollectionType
        {
            get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
        }
        protected override ConfigurationElement CreateNewElement()
        {
            return new InitializationVariable();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return (element as InitializationVariable).Name;
        }

        public string GetVariableValue(string variableName)
        {
            string result = null;
            InitializationVariable variable = BaseGet(variableName) as InitializationVariable;
            if (variableName != null) result = variable.Value;
            return result;
        }
    }
}
